# coding=utf-8
from appium import webdriver
import time
import unittest
from PO.IndexPage import IndexPage
from PO.MsgPage import MsgCenter
from Public.log import Logger

log = Logger('TestMsg').getlog()
class TestMsg(unittest.TestCase):
    """验证消息中心"""

    def setUp(self):
        capabilities = {
            'platformName': 'Android',
            'platformVersion': '4.4.2',
            'deviceName': '127.0.0.1:62001',
            'appPackage': 'com.guokr.mentor',
            'appActivity': '.ui.activity.MainActivity',
            'unicodeKeyboard': True,
            'resetKeyboard': True,
            'noReset': True
        }
        self.driver = webdriver.Remote("http://localhost:4723/wd/hub", capabilities)
        self.myindex = IndexPage(self.driver)
        self.mymsg = MsgCenter(self.driver)

    def tearDown(self):
        self.driver.quit()

    def test01(self):
        log.info('测试用例开始')
        self.myindex.home_page()
        log.info('打开app首页')
        time.sleep(2)
        self.myindex.msgCenter()
        log.info('打开消息中心')
        time.sleep(2)
        self.assertEqual(self.mymsg.title(), "消息中心")
        log.info('测试用例结束')
